package com.spzx.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Aspect
public class RequestLogAspect {
@Pointcut("execution(public * com.spzx.controller.HelloAopController.hello*(..))")
public void beforePointcut(){};
    @Before("beforePointcut()")
    public void doBefore(JoinPoint joinPoint) throws Throwable
    {
        System.out.println("---------前置通知222:RequestLogAspect----> "+joinPoint.getTarget().getClass().getName());
    }

//    @Before("execution(public * com.spzx.controller.HelloAopController.hello*(..))")
//    public void doBefore(JoinPoint joinPoint) throws Throwable
//    {
//        System.out.println("---------前置通知222:RequestLogAspect----> "+joinPoint.getTarget().getClass().getName());
//    }

    @After("execution(public * com.spzx.controller.HelloAopController.hello*(..))")
    public void doAfter(JoinPoint joinPoint) throws Throwable
    {
        System.out.println("---------后置通知222:RequestLogAspect----> "+joinPoint.getTarget().getClass().getName());
    }
}
